{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[1. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
      " [0. 1. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
      " [0. 0. 1. 0. 0. 0. 0. 0. 0. 0.]\n",
      " [0. 0. 0. 1. 0. 0. 0. 0. 0. 0.]\n",
      " [0. 0. 0. 0. 1. 0. 0. 0. 0. 0.]\n",
      " [0. 0. 0. 0. 0. 1. 0. 0. 0. 0.]\n",
      " [0. 0. 0. 0. 0. 0. 1. 0. 0. 0.]\n",
      " [0. 0. 0. 0. 0. 0. 0. 1. 0. 0.]\n",
      " [0. 0. 0. 0. 0. 0. 0. 0. 1. 0.]\n",
      " [0. 0. 0. 0. 0. 0. 0. 0. 0. 1.]]\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "from matplotlib import  pyplot as plt\n",
    "\n",
    "#numpy的使用\n",
    "a = np.eye(10)\n",
    "print(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]\n",
      " [1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]\n",
      " [1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]\n",
      " [1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]\n",
      " [1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]\n",
      " [1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]\n",
      " [1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]\n",
      " [1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]\n",
      " [1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]\n",
      " [1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]]\n"
     ]
    }
   ],
   "source": [
    "b = np.ones([10,10])\n",
    "print(b)\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[2. 1. 1. 1. 1. 1. 1. 1. 1. 1.]\n",
      " [1. 2. 1. 1. 1. 1. 1. 1. 1. 1.]\n",
      " [1. 1. 2. 1. 1. 1. 1. 1. 1. 1.]\n",
      " [1. 1. 1. 2. 1. 1. 1. 1. 1. 1.]\n",
      " [1. 1. 1. 1. 2. 1. 1. 1. 1. 1.]\n",
      " [1. 1. 1. 1. 1. 2. 1. 1. 1. 1.]\n",
      " [1. 1. 1. 1. 1. 1. 2. 1. 1. 1.]\n",
      " [1. 1. 1. 1. 1. 1. 1. 2. 1. 1.]\n",
      " [1. 1. 1. 1. 1. 1. 1. 1. 2. 1.]\n",
      " [1. 1. 1. 1. 1. 1. 1. 1. 1. 2.]]\n",
      "<class 'numpy.ndarray'>\n"
     ]
    }
   ],
   "source": [
    "c =a+b\n",
    "print(c)\n",
    "print(type(c))"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "data = pd.read_csv('data/data.csv')\n",
    "data.head(10)\n",
    "print(type(data))"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "outputs": [
    {
     "data": {
      "text/plain": "0    90\n1    71\n2    54\n3    39\n4    26\nName: y, dtype: int64"
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#取数据\n",
    "x = data.loc[:,'x']\n",
    "x.head()\n",
    "y = data.loc[:,'y']\n",
    "y.head()\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "outputs": [
    {
     "data": {
      "text/plain": "<Figure size 432x288 with 1 Axes>",
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAD4CAYAAAD1jb0+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAASRUlEQVR4nO3dbYxcZ3mH8evu2oHlrU6aTbCdpA5StCVtVTkdpYG0CCnQhRQRg5QqSLRWiWQhlRb64mIXCZBQ1dBtUVuJUqVA67YRNALjRDR0SQ2o6gdS1tkkTnC2Nm8ha2MbqgXarsBx736Ys2G9mcnO7s6ZmWf2+knWzDxzZs89zznn7zPnNTITSVJ5fqzfBUiS1sYAl6RCGeCSVCgDXJIKZYBLUqE29XJkl156ae7YsaOXo5Sk4h05cuTbmTm2vL2nAb5jxw6mp6d7OUpJKl5EfKNVu5tQJKlQBrgkFcoAl6RCGeCSVCgDXJIK1dOjUNbi0Mwck1OznJxfYNuWUfZOjLNr5/Z+lyVJHakzwwY6wA/NzLH/4FEWzp0HYG5+gf0HjwIY4pIGXt0ZNtCbUCanZp/+4osWzp1ncmq2TxVJUufqzrCBDvCT8wurapekQVJ3hg10gG/bMrqqdkkaJHVn2EAH+N6JcUY3j1zQNrp5hL0T432qSJI6V3eGDfROzMWN/B6FIqlEdWdY9PKemI1GI72YlSStTkQcyczG8vaB3oQiSWrPAJekQhngklQoA1ySCmWAS1KhDHBJKpQBLkmFMsAlqVAGuCQVygCXpEIZ4JJUKANckgrVUYBHxO9ExGMR8WhEfCwinhsRl0TE/RFxvHq8uO5iJUk/smKAR8R24LeBRmb+DDAC3AbsAw5n5jXA4eq1JKlHOt2EsgkYjYhNwPOAk8AtwIHq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ElbT3vL5r/gZwCzlXZdXu7HKpjWfRUekkqVCmbUCRJyxjgklQoA1ySCmWAS1KhDHBJKpQBLkmFMsAlqVD/D3Anl2IimdcuAAAAAElFTkSuQmCC\n"
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig3 = plt.figure()\n",
    "plt.scatter(x,y)\n",
    "plt.show()\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'numpy.ndarray'> <class 'pandas.core.frame.DataFrame'>\n"
     ]
    }
   ],
   "source": [
    "data_array = np.array(data)\n",
    "print(type(data_array),type(data))\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "outputs": [],
   "source": [
    "#生成新的数据,每个元素减10\n",
    "data_new = data -10\n",
    "\n",
    "#生成csv\n",
    "data_new.to_csv(\"data/data_new.csv\")\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}